package com.jltx.storage.coroutinesdownloader


/**
 * @author jltxseo
 *         Created by junlintianxia on 2020/04/15.
 */
class RequestResult {
    var filePath: String? = null
    var url: String? = null
    var status = 0
    var total: Long = 0
    var progress: Long = 0
    var error: Throwable? = null

    @JvmOverloads
    constructor(
        filePath: String,
        url: String,
        status: Int,
        total: Long = 0,
        progress: Long = 0
    ) {
        this.filePath = filePath
        this.url = url
        this.status = status
        this.total = total
        this.progress = progress
        error = null
    }

    constructor(
        filePath: String,
        url: String,
        status: Int,
        total: Long,
        progress: Long,
        error: Throwable?
    ) {
        this.filePath = filePath
        this.url = url
        this.status = status
        this.total = total
        this.progress = progress
        this.error = error
    }

    constructor(
        filePath: String,
        url: String,
        status: Int,
        error: Throwable?
    ) : this(filePath, url, status, 0, error) {
    }

    constructor(
        filePath: String,
        url: String,
        status: Int,
        total: Long,
        error: Throwable?
    ) : this(filePath, url, status, total, 0, error) {
    }

    override fun toString(): String {
        return "RequestResult{" +
                "filePath='" + filePath + '\'' +
                ", url='" + url + '\'' +
                ", status=" + status +
                ", total=" + total +
                ", progress=" + progress +
                '}'
    }
}
